    <div class="site_map" align="left"><a href="/onlinemarket/shops">Sản phẩm </a><img src="/onlinemarket/img/navbit-arrow-right.png"/><a href="/onlinemarket/product_groups"> Nhóm sản phẩm</a> <img src="/onlinemarket/img/navbit-arrow-right.png"/><a href="/onlinemarket/product_groups/index2"> Quản lý menu</a></div>
    <div class="heading">
        <div class="heading_left"></div>
        <div class="heading_right"></div>
        <div class="heading_center">
        	<h3>Danh Mục Sản Phẩm</h3>
        </div>

        <div class="table">
            <h1>&nbsp;</h1>
            <form method="post" id="Product_group" name="Product_group" action="/onlinemarket/product_groups/quick_create">
                 <table style="padding-left: 20px; padding-right: 20px;" class="noborder">
                <tr>
                    <td>
                        <table style="float: left;" >
                            <input type="hidden" id="id" name="id" value="<?php echo($iProduct_group['ProductGroup']['id']); ?>"/>
                            <tr style="vertical-align: top;">
                                <td><font color="red">*</font>Menu cha</td>
								<td>
    								<select name="parent_group_id" id="parent" name="parent" style="width:200;text-align:center">
    										<option value="<?php echo($iProduct_group['ProductGroup']['id']); ?>"> <?php echo($iProduct_group['ProductGroup']['name']);?> </option>
    								</select>
                                </td>
                            </tr>
                            <tr style="vertical-align: top;">
                                <td><font color="red">*</font>Mô tả danh mục</td>
                                <td><textarea name="description" rows="4" cols="22" id="description"><?php echo($iProduct_group['ProductGroup']['description']);?></textarea> </td>
                            </tr>
                            </table>
                            <table>
                            <tr style="vertical-align: top;">
                                <td><font color="red">*</font>Tên danh mục</td>
                                <td><textarea name="menus" id="menus" style="width: 491px; height: 120px;"></textarea></td>
                            </tr>
                            <tr>
                                <td colspan="2" style="text-align: right;">( Các danh mục phân cách nhau bởi dấu chấm (.) )</td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <input type="submit" value="Lưu" style="height: 25px; padding-top: 0.3em;"/>
       					<input type="button" value="Hủy" style="height: 25px; padding-top: 0.3em;" onclick="onCancel();"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="padding-bottom: 0;"><hr /></td>
                </tr>
                <tr>
                    <td colspan="2" style="padding-top: 0;">Trường <font color="red">*</font> yêu cầu phải nhập</td>
                </tr>
                </table>
            </form>
        </div>
<table class="border" style="width: 100%;">
    <tr>
        <td colspan="7" align="center"><a href="/onlinemarket/productGroups">Thêm danh mục mới</a></td>
    </tr>
    <tr>
        <th>id</th>
        <th>name</th>
        <th>parent</th>
        <th>description</th>
		<th>action</th>
    </tr>
<?php foreach ($product_group as $pro) : ?>
<tr>
    <td align="left"><?php echo($pro['ProductGroup']['id']); ?></td>
    <td align="left"><?php echo($pro['ProductGroup']['name']); ?></td>
	<td align="center">
	   <?php foreach($product_group_view as $product_group) {
				if($product_group['ProductGroup']['id']==$pro['ProductGroup']['parent_group_id']){ ?>
                    <?php echo($product_group['ProductGroup']['name']); } } ?>
    &nbsp;</td>
    <td align="left"><?php echo($pro['ProductGroup']['description']); ?></td>
	<td align="left">
        <img style="cursor: pointer;" src="/onlinemarket/img/system/bt_edit.png" onclick="onEdit('/onlinemarket/product_groups/index/ <?php echo($pro['ProductGroup']['id']);?>')" alt="Sửa" title="Sửa"/>
        <img style="cursor: pointer;" src="/onlinemarket/img/system/bt_delete.png" onclick="onEdit('/onlinemarket/product_groups/delete/?id=<?php echo($pro['ProductGroup']['id']);?>')" alt="Xóa" title="Xóa"/>
    </td>
</tr>
<?php endforeach; ?>
</table>

</div>
<script>
function onEdit(link) {
        window.location = link;
    }
    function onCancel() {
        $('form').slideUp('slow');
    }
    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split('&');
        for (var i=0; i<vars.length; i++) {
            var pair = vars[i].split('=');
            if (pair[0] == variable) {
                return pair[1];
            }
        }
    };

</script>
